<extend name="Public/base" />

<block name="body">
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <div class="main-title cf">
        <h2>编辑 [广告列表]</h2>
    </div>
    <!-- 标签页导航 -->
<div class="tab-wrap">
    <ul class="tab-nav nav">
		<li data-tab="tab1" class="current"><a href="javascript:void(0);">基础</a></li></li>
    </ul>
    <div class="tab-content zc_for">
    <!-- 表单 -->
    <form id="form" action="{:U('edit_adv?model='.$model['id'])}" method="post" class="form-horizontal">
        <!-- 基础文档模型 -->
        <div id="tab1" class="tab-pane in tab1 tab-look">
            <table  border="0" cellspacing="0" cellpadding="0">
                <tbody>
                    <tr>
                        <td class="l">广告标题：</td>
                        <td class="r" >
                           <input type="text" class="txt " name="title" value="{$data['title']}" >
                        </td>

                        <td class="l">广告链接：</td>
                        <td class="r" >
                           <input type="text" class="txt " name="url" value="{$data['url']}">
                        </td>
                    </tr>
                     <tr>
                        <td class="l">开始时间：</td>
                        <td class="r">
                           <input type="text" class="txt time" name="start_time" value="{:set_show_time($data['start_time'])}" placeholder="默认没有时间限制">
                        </td>
                         <td class="l">结束时间：</td>
                        <td class="r">
                          <input type="text" class="txt time" name="end_time" value="{:set_show_time($data['end_time'])}" placeholder="默认没有时间限制">
                        </td>
                    </tr>
                    <tr>
                        <td class="l">广告排序：</td>
                        <td class="r">
                            <input type="text" class="txt" name="sort" value="{$data['sort']}">
                        </td>
                        <!-- <td class="l">打开方式：</td>
                        <td class="r">
                           <label class="inp_radio">
                                <input type="radio" class="inp_radio" value="_blank" name="target" checked="checked">新页面
                                <input type="radio" class="inp_radio" value="_self" name="target" >本页面
                            </label>
                        </td> -->
                    </tr>
                    <tr>
                        <td class="l">广告图片：</td>
                        <td class="r" colspan='3'>
                            <input type="file" id="upload_picture_pic">
                            <input type="hidden" name="data" id="pic_id" value="{$data['data']}"/>
                            <div class="upload-img-box">
                            <notempty name="data['data']">
                                <div class="upload-pre-item"><img src="{$data['data']|get_cover='path'}"/></div>
                            </notempty>
                            </div>
                            <span class="infonotice" style="top:20px;" >({$advpos.width}*{$advpos.height})</span>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="form-item cf">
            <input type='hidden' name="id" value="{$data['id']}" />
            <button class="btn submit-btn ajax-post hidden" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <a class="btn btn-return" href="javascript:history.back(-1);">返 回</a>
        </div>
    </form>
    </div>
</div>
</block>

<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('Adv/adv_lists')}');
$(function(){
    $("#game_name").val($("#game_id option:selected").text());
    $('.date').datetimepicker({
        format: 'yyyy-mm-dd',
        language:"zh-CN",
        minView:2,
        autoclose:true
    });
    $('.time').datetimepicker({
        language:"zh-CN",
        hour: 13,
        minute: 15
    });
    showTab();

});
//Think.setValue("module", {$data.module|default = 'media'});
/* 初始化上传插件 */
$("#upload_picture_pic").uploadify({
    "height"          : 30,
    "swf"             : "__STATIC__/uploadify/uploadify.swf",
    "fileObjName"     : "download",
    "buttonText"      : "上传图标",
    "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
    "width"           : 120,
    'removeTimeout'   : 1,
    'fileTypeExts'    : '*.jpg; *.png; *.gif;',
    "onUploadSuccess" : upload_picture_pic{$field.name},
    'onFallback' : function() {
        alert('未检测到兼容版本的Flash.');
    }
});
function upload_picture_pic{$field.name}(file, data){
    var data = $.parseJSON(data);
    var src = '';
    if(data.status){
        $("#pic_id").val(data.id);
        src = data.url || '__ROOT__' + data.path;
        $("#pic_id").parent().find('.upload-img-box').html(
            '<div class="upload-pre-item"><img src="' + src + '"/></div>'
        );
    } else {
        updateAlert(data.info);
        setTimeout(function(){
            $('#top-alert').find('button').click();
            $(that).removeClass('disabled').prop('disabled',false);
        },1500);
    }
}
$('#submit').click(function(){
    $('#form').submit();
});
</script>
</block>
